package com.community.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.community.dao.ParkingDao;
import com.community.entity.Parking;
import com.community.service.ParkingService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("ParkingService")
public class ParkingServiceImp extends ServiceImpl<ParkingDao, Parking> implements ParkingService {

    @Resource
    ParkingDao parkingDao;

    @Override
    public String randomParking() {
        List<Parking> list = parkingDao.randomParking();
        int rd = (int) Math.floor((Math.random() * list.size()));
        return list.get(rd).getStall();
    }
}
